/*
    提供通用的功能
 */
$(function () {

    wow = new WOW(
        {
            boxClass: 'wow',      // 默认属性名
            animateClass: 'animated', // 默认触发的动画类(包含在animate css中)
            offset: 0,          // 为所有添加wow的元素设置 data-wow-delay属性 的默认值
            mobile: true,       // 是否在移动设备中开启动画
            live: true        // 持续监测页面中是否插入新的wow元素
        }
    );
    wow.init();

    showTiTle();
})

/**
 * 自定义title样式
 * @type {null}
 */
function showTiTle() {

    var oldTitle = null;
    $(".hover-title").bind('mouseover mouseout mousemove',function(event){
        var left = event.pageX , top = event.pageY;
        var ele = event.target;
        var title = ele.title;

        var type = event.originalEvent.type;
        if(type == 'mouseover'){
            oldTitle = title;
            ele.title = '';
            //if(title && title.length > 0){
            if(title != null){
                var showEle = $('<div></div>',{text:title,class:'showTitleBox'}).css({
                    position:'absolute',
                    top:top+10,
                    left:left,
                    padding:"2px",
                    border:'1px solid #e2e2e2',
                    borderRadius:'5px',
                    backgroundColor:"white",
                    fontFamily:'SimHei',
                    fontSize:'12px',
                    color:"#black",
                    fontWeight:"bold"
                })
                showEle.appendTo('body');
            }
        }else if(type == 'mouseout'){
            ele.title = oldTitle;
            $('.showTitleBox').remove();
        }else if(type == 'mousemove'){
            $('.showTitleBox').css({
                top:top+10,
                left:left
            })
        }
    })


}



